import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
import Home from '../views/Home.vue'
import About from '../views/About.vue'
import News from '../views/homeNews.vue'
import Message from '../views/homeMessage.vue'
import Foo from '../views/Foo.vue'
import MsgDetail from '../views/MsgDetail.vue'
import NewsDetail from '../views/newsDetail.vue'
const router = new VueRouter({
  routes: [
    { path: '/', redirect: '/home' },
    {
      path: '/home',
      component: Home,
      children: [
        {
          path: 'news',
          component: News,
          children: [
            { name: "newsDetail", path: 'newsdetail', component: NewsDetail,props({query}){
              return query
            } },
          ],
        },
        {
          path: 'message',
          component: Message,
          children: [
            {
              name: 'MsgDetail',
              path: 'msgdetail/:id/:title/:content',
              component: MsgDetail,
              props: true,
            },
          ],
        },
        {path:"foo",component:Foo}
      ],
    },
    { path: '/about', component: About },
  ],
})
export default router
